When cameras or camera modules for various electronic devices are manufactured, the spatial black level of a camera module may vary from module to module. In addition to the spatial black level, there may be defective pixels (too bright or too dark pixels) and fixed pattern noise which then appear on the same location from image to image when the camera module is used to record image data. Some calibration can be done during camera module manufacturing, but the final spatial black level is usually known only after the camera module integration to a product.